package com.xuyaxu.controller;

import com.xuyaxu.domain.PushMessage;
import com.xuyaxu.service.SocketIOService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 类的描述
 *
 * @author xuyaxu
 * @date 2021/10/14 16:44
 */
@RestController
@RequestMapping("socketio")
public class SocketIOController {

    @Autowired
    private SocketIOService socketIOService;

    @GetMapping("sendMessage")
    public String sendMessage(String message) {
        PushMessage pushMessage = new PushMessage(79, message);
        socketIOService.pushMessageToUser(pushMessage);
        return "请求发送成功";
    }

}
